<template>
  <!-- <img :class="[item.config['tag'], item.typeId]" :src="getScr()" crossorigin="anonymous"> -->
  <div class="d-pic" @click="selectModel">
    <template v-if="!getScr()">
      <div class="d-pic-txt-content flex-center">
        <span class="pic-txt">请设置模块图片</span>
      </div>
    </template>
    <template v-else>
      <img class="pic-model" :src="getScr()" crossorigin="anonymous">
    </template>
  </div>
</template>

<script>
import mixin from '../mixin'

export default {
  name: 'DPic',
  mixins: [mixin],
  created() {
    console.log(this.item, 99999)
  },
  methods: {
    getScr(){
      let _self = this
      let {imageUrl} = _self.item['configH5']
      return imageUrl || ''
    },
    selectModel(){
      this.$emit('edit-model', this.item)
    }
  },
}
</script>

<style scoped lang="scss">
.d-pic{
  display: block;
  .pic-model{
    display: block;
    width: 100%;
    object-fit: contain;
  }
  .d-pic-txt-content{
    height: rem(300);
    margin: rem(40);
    border-radius: rem(18);
    border: 1px dotted #999;
    cursor: pointer;
    .pic-txt{
      font-size: 13px;
      color: #999;
    }
  }
}
</style>
